$(function (e) {
    init();
    function init() {
        $(".loginBtn").on("tap", function (e) {
            var username = $.trim($(".username").val());
            var password = $.trim($(".password").val());
            if ($(".userName").val().length < 6) {
                mui.toast("用户名不合法");
                return;
            }
            if ($(".password").val().length < 6) {
                mui.toast("密码不合法");
                return;
            }
            $.post("/user/login", $(".login_form").serialize(), function (res) {
                if (res.error) {
                    mui.toast(res.message);
                }
                else {
                    var returnURL = $.getQueryString("returnURL");
                    if (returnURL) {
                        location.href = returnURL;
                    }
                    else {
                        location.href = "../index.html";
                    }
                }
            })
        })
    }
})